//
//  SecondOneCell.m
//  ShopDemo
//
//  Created by 飞扬的青春 on 2018/7/10.
//  Copyright © 2018年 飞扬的青春. All rights reserved.
//

#import "SecondOneCell.h"

@implementation SecondOneCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        UIView *backview = [UIView new];
        backview.layer.masksToBounds = YES;
        backview.layer.cornerRadius = 8*kJLXWidthScale;
        backview.layer.borderColor = LineColor.CGColor;
        backview.layer.borderWidth = 1;
        [self.contentView addSubview:backview];
        backview.sd_layout
        .topSpaceToView(self.contentView, 5*kJLXWidthScale)
        .bottomSpaceToView(self.contentView, 5*kJLXWidthScale)
        .leftSpaceToView(self.contentView, 10*kJLXWidthScale)
        .rightSpaceToView(self.contentView, 10*kJLXWidthScale);
        
        UILabel *onelab = [UILabel new];
        self.namelab = onelab;
        onelab.textColor = LineColor;
        onelab.font = [UIFont systemFontOfSize:14*kJLXWidthScale];
        [backview addSubview:onelab];
        onelab.sd_layout
        .topSpaceToView(backview, 15*kJLXWidthScale)
        .leftSpaceToView(backview, 8*kJLXWidthScale)
        .heightIs(30*kJLXWidthScale)
        .rightSpaceToView(backview, 100*kJLXWidthScale);
        
        UILabel *twolab = [UILabel new];
        self.titlab = twolab;
        twolab.font = [UIFont systemFontOfSize:18*kJLXWidthScale];
        [backview addSubview:twolab];
        twolab.sd_layout
        .topSpaceToView(onelab, 0)
        .leftSpaceToView(backview, 8*kJLXWidthScale)
        .heightIs(30*kJLXWidthScale)
        .rightSpaceToView(backview, 100*kJLXWidthScale);
        
        UILabel *thirdlab = [UILabel new];
        self.contlab = thirdlab;
        thirdlab.textColor = [UIColor darkGrayColor];
        thirdlab.numberOfLines = 2;
        thirdlab.font = [UIFont systemFontOfSize:15*kJLXWidthScale];
        [backview addSubview:thirdlab];
        thirdlab.sd_layout
        .topSpaceToView(twolab, 0)
        .leftSpaceToView(backview, 8*kJLXWidthScale)
        .rightSpaceToView(backview, 100*kJLXWidthScale)
        .heightIs(50*kJLXWidthScale);
        
        UILabel *fourlab = [UILabel new];
        self.datelab = fourlab;
        fourlab.textColor = LineColor;
        fourlab.font = [UIFont systemFontOfSize:13*kJLXWidthScale];
        [backview addSubview:fourlab];
        fourlab.sd_layout
        .topSpaceToView(thirdlab, 0)
        .leftSpaceToView(backview, 8*kJLXWidthScale)
        .rightSpaceToView(backview, 100*kJLXWidthScale)
        .heightIs(20*kJLXWidthScale);
        
        UIView *lineview = [UIView new];
        lineview.backgroundColor = LineColor;
        [backview addSubview:lineview];
        lineview.sd_layout
        .topSpaceToView(fourlab, 8*kJLXWidthScale)
        .leftSpaceToView(backview, 0)
        .rightSpaceToView(backview, 0)
        .heightIs(1);
        
        for (int i = 0; i < 2; i ++) {
            MineButton *btn = [MineButton buttonWithType:UIButtonTypeCustom];
            [backview addSubview:btn];
            if (i == 0) {
                self.onebtn = btn;
                btn.sd_layout
                .topSpaceToView(lineview, 8*kJLXWidthScale)
                .bottomSpaceToView(backview, 8*kJLXWidthScale)
                .widthIs(50*kJLXWidthScale)
                .leftSpaceToView(backview, 65*kJLXWidthScale);
            }else{
                self.twobtn = btn;
                btn.sd_layout
                .topSpaceToView(lineview, 8*kJLXWidthScale)
                .bottomSpaceToView(backview, 8*kJLXWidthScale)
                .widthIs(70*kJLXWidthScale)
                .rightSpaceToView(backview, 65*kJLXWidthScale);
            }
            btn.mineimagevi = [UIImageView new];
            btn.mineimagevi.userInteractionEnabled = NO;
            [btn addSubview:btn.mineimagevi];
            btn.mineimagevi.sd_layout
            .topSpaceToView(btn, 0)
            .bottomSpaceToView(btn, 0)
            .leftSpaceToView(btn, 0)
            .widthIs(btn.size.width/2);
            
            btn.minlab = [UILabel new];
            btn.minlab.font = [UIFont systemFontOfSize:16*kJLXWidthScale];
            btn.minlab.userInteractionEnabled = NO;
            [btn addSubview:btn.minlab];
            btn.minlab.sd_layout
            .topSpaceToView(btn, 0)
            .bottomSpaceToView(btn, 0)
            .rightSpaceToView(btn, 0)
            .widthIs(btn.size.width/2);
            if (i == 1) {
                btn.mineimagevi.sd_layout
                .topSpaceToView(btn, 0)
                .bottomSpaceToView(btn, 0)
                .leftSpaceToView(btn, 0)
                .widthIs(btn.size.width/2 - 8*kJLXWidthScale);
                btn.minlab.text = @"评论";
                btn.minlab.textColor = [UIColor lightGrayColor];
                btn.mineimagevi.image = [UIImage imageNamed:@"chat_icon.png"];
            }else{
                btn.minlab.textAlignment = NSTextAlignmentCenter;
                btn.minlab.textColor = [UIColor darkGrayColor];
                btn.mineimagevi.image = [UIImage imageNamed:@"zan_nom.png"];
            }
            
        }
        
        
        UIImageView *largimagevi = [UIImageView new];
        self.titimageVI = largimagevi;
        [backview addSubview:largimagevi];
        largimagevi.sd_layout
        .topSpaceToView(backview, 35*kJLXWidthScale)
        .bottomSpaceToView(lineview, 35*kJLXWidthScale)
        .rightSpaceToView(backview, 10*kJLXWidthScale)
        .widthIs(80*kJLXWidthScale);
        
    }
    return self;
}




- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
